package lanQiaoBei.基础算法.sort;
/*快速排序模板*/

import java.io.*;
import java.lang.*;

public class P1 {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static int N = 100010;
    static int n;
    static int[] a = new int[N];

    public static void main(String[] args) throws Exception {
        scan();
        quick_sort(0, n - 1, a);
        for (int i = 0; i < n; i++) {
            System.out.print(a[i] + " ");
        }
    }
    public static void quick_sort(int l,int r,int[]a){
           if(l>=r)return;
           int x=a[l],i=l-1,j=r+1;
           while(i<j){
               do i++;while(a[i]<x);
               do j--;while(a[j]>x);
               if(i<j)swap(i,j,a);
           }
           quick_sort(l,j,a);
           quick_sort(j+1,r,a);
    }

    private static void swap(int i, int j, int[] a) {
        int t = a[i];
        a[i] = a[j];
        a[j] = t;
    }

    public static void scan() throws Exception {
        n = Integer.parseInt(br.readLine());
        String[] ss = br.readLine().split(" ");
        for (int i = 0; i < n; i++)
            a[i] = Integer.parseInt(ss[i]);
    }
}
